#include<cstdio>
#include<iostream>
#include<unistd.h>

#include<pthread.h>

using namespace std;
void* task(void* arg){
    int count = 0;
    printf("0x%x",&count);
    //const char* tmp = static_cast<const char*>(arg);
    // while(true){
    //     printf("this is thread:%s\n",tmp);
    //     count++;
    //     if(count == 10) break;
    //     sleep(1);
    // }
    pthread_exit((void*)"我是新线程,我结束了");
    //return (void*)"我是新线程,我结束了";
}

int main(){

    pthread_t tid  = 0;
    pthread_create(&tid,nullptr,task,(void*)"this is new thread");

    void* ret = nullptr;
    pthread_cancel(tid);    
    pthread_join(tid,&ret);
    printf("return val :0x%x\n",tid);

    return 0;
}